<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="UTF-8"/>
    <link th:rel="stylesheet" th:href="@{/webjars/bootstrap/4.6.0-1/css/bootstrap.min.css} "/>
    <title>SMW</title>
</head>

<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
    <div class="container">
        <a class="navbar-brand" href="/">Stock Market Watcher</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive"
                aria-controls="navbarResponsive"
                aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarResponsive">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item active">
                    <a class="nav-link" href="#">Register & Login
                        <span class="sr-only">(current)</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Contact</a>
                </li>
            </ul>
        </div>
    </div>
</nav>
<div class="container">
    <div class="row">
        <div class="col-lg-10 mt-5 mb-5">

            <h1>User Login Page</h1>
            <form th:action="@{/login}" method="post">

                <!-- error message -->
                <div th:if="${param.error}">
                    <div class="alert alert-danger">Invalid username or
                        password.
                    </div>
                </div>

                <!-- logout message -->
                <div th:if="${param.logout}">
                    <div class="alert alert-info">You have been logged out.</div>
                </div>

                <div class="form-group">
                    <label for="username"> Username </label>
                    <input type="text"
                           class="form-control" id="username" name="username"
                           placeholder="Enter Email ID"
                           autofocus="autofocus">
                </div>

                <div class="form-group">
                    <label for="password">Password</label>
                    <input type="password"
                           id="password" name="password" class="form-control"
                           placeholder="Enter Password"/>
                </div>

                <div class="form-group">
                    <div class="row">
                        <div class="col-sm-6 col-sm-offset-3">
                            <input type="submit" name="login-submit" id="login-submit"
                                   class="form-control btn btn-primary" value="Log In"/>
                        </div>
                    </div>
                </div>
            </form>
            <div class="form-group">
                <span>New user? <a href="/" th:href="@{/registration}">Register here</a></span>
            </div>
        </div>
    </div>
</div>

</body>
</html>